package kernel;

import java.awt.Color;
import java.util.ArrayList;

/**
 * A set of points that represent a fiber
 *
 */
public class Fiber {

	private ArrayList<double[]> points;
	private Color fiberColor;
	private String fiberName;
	private int fiberId;

	/**
	 * Basic constructor
	 */
	public Fiber()
	{
		fiberName = "Fiber";
		points = new ArrayList<double[]>();
		fiberColor = Color.GRAY;
	}
	/**
	 * Returns the identifier of the fiber
	 * @return fiber id
	 */
	public int getFiberId() {
		return fiberId;
	}

	/**
	 * Sets the fiber identifier
	 * @param fiberId fiber id
	 */
	public void setFiberId(int fiberId) {
		this.fiberId = fiberId;
	}
	/**
	 * Sets the fiber name
	 * @param name the fiber name
	 */
	public void setFiberName (String name)
	{
		fiberName = name;
	}
	/**
	 * Returns the points of the fiber
	 * @param points fiber points
	 */
	public Fiber(ArrayList<double[]> points)
	{
		this();
		this.points = points;
	}

	/**
	 * Creates a new fiber with the points and the color given
	 * @param points fiber points
	 * @param color fiber color
	 */
	public Fiber(ArrayList<double[]> points, Color color)
	{
		this();
		this.points = points;
		if(color == null)
		{
			color = Color.GRAY;
		}
		this.fiberColor = color;
	}

	/**
	 * Returns the list of points of the fiber
	 * @return fiber points
	 */
	public ArrayList<double[]> getPoints() {
		return points;
	}

	/**
	 * Returns the fiber color for rendering
	 * @return fiber color
	 */
	public Color getFiberColor() {
		return fiberColor;
	}

	/**
	 * Returns the fiber name
	 * @return fiber name
	 */
	public String getFiberName() {
		return fiberName;
	}

	/**
	 * Tells if two fibers are equal
	 * @param f
	 * @return
	 */
	public boolean equals(Fiber f)
	{
		if(f.fiberId == fiberId)
		{
			return true;
		}
		return false;
	}
}
